<template>
  <div class="centerContainer">
      <div class="header">
        <div class="avator">
          <img class="img" src="@/static/images/user.png" alt="">
        </div>
        <div class="user">
          <div v-if="userInfo.nickName">{{ userInfo.nickName }}</div>
          <div v-else>用户68556137</div>
          <div class="desc">普通用户</div>
        </div>
        <div class="link">
        </div>
        <div class="vip">
          <div class="thor"></div>
          <div class="text">
            <div class="word1">Pro会员</div>
            <div class="word2">立即开通<van-icon class="icon" size="1px" name="arrow" /></div>
          </div>
        </div>
      </div>
      <div class="asset">
        <div class="my_asset">
          我的资产
        </div>
        <div class="assetList">
          <div class="assetItem" v-for="(item,index) in asset" :key="item.fundType">
            <div class="sum">
              <span>￥</span>
              <sapn class="num">{{ item.fundValue }}</sapn> 
            </div>
            <div class="desc">{{ item.fundName }}</div>
          </div>
        </div>
      </div>
      <div style="background-color: #fff; " >
        <div class="advert">
        <img class="anniversary" src="@/static/images/anniversary.png" alt="">
        <img class="welfare" src="@/static/images/welfare.png" alt="">
        <div class="desc">| 花3得34元 一笔回本</div>
        <div class="btn">限时开通</div>
      </div>
      </div>
      <div class="middle">
        <div class="card">
          <img class="cardImg" src="@/static/images/card.jpg" alt="">
        </div>
        <div class="list">
          <div class="item" v-for="(order,index) in orders" :key="order.id">
            <van-icon class="icon" :name="order.icon" size="25px" />
            <div class="desc">{{order.title}}</div>
          </div>
        </div>
      </div>
      <div class="bottom">
        <van-button class="logout" size="normal" @click="logout" block>退出登录</van-button>
      </div>
      
  </div>
</template>
<script lang="ts">
  import { defineComponent } from 'vue';
import { storeToRefs } from 'pinia';
  export default defineComponent({
    name:'CatoryList',
  })
</script>
<script lang="ts" setup>
import { ref } from 'vue';
import { useUserInfoStore } from '@/stores/userInfo';
//  伪 个人展示信息数据
const asset =ref([
    {
        "fundType": 1,
        "fundValue": "0",
        "fundName": "余额",
        "targetUrl": "/reward/index"
    },
    {
        "fundType": 2,
        "fundValue": "0",
        "fundName": "红包",
        "targetUrl": "/redpacket"
    },
    {
        "fundType": 3,
        "fundValue": "0",
        "fundName": "优惠券",
        "targetUrl": "/coupon"
    },
    {
        "fundType": 6,
        "fundValue": "0",
        "fundName": "积分",
        "targetUrl": "/points/index"
    },
    {
        "fundType": 5,
        "fundValue": "0",
        "fundName": "礼品卡",
        "targetUrl": "/giftCard/list"
    }
])

const {userInfo} = storeToRefs(useUserInfoStore())

// 伪 个人中心数据
const orders = ref([
  {
    icon:'orders-o',
    id:1,
    title:'我的订单'
  },
  {
    icon:'user-circle-o',
    id:2,
    title:'账号管理'
  },
  {
    icon:'phone-o',
    id:3,
    title:'我的手机号'
  },
  {
    icon:'shop-o',
    id:4,
    title:'周六一起go'
  },
  {
    icon:'after-sale',
    id:5,
    title:'售后服务'
  },
  {
    icon:'balance-pay',
    id:6,
    title:'邀请返利'
  },
  {
    icon:'bag-o',
    id:7,
    title:'优先购'
  },
  {
    icon:'gift-o',
    id:8,
    title:'积分中心'
  },
  {
    icon:'diamond-o',
    id:9,
    title:'会员俱乐部'
  },
  {
    icon:'location-o',
    id:10,
    title:'地址管理'
  },
  {
    icon:'passed',
    id:11,
    title:'支付安全'
  },
  {
    icon:'service-o',
    id:12,
    title:'帮助与客服'
  },
  {
    icon:'records',
    id:13,
    title:'意见反馈'
  },
  {
    icon:'points',
    id:14,
    title:'我的购买'
  }
])

const userStore = useUserInfoStore()

// 退出登录
const logout = ()=>{
  userStore.logout()
}

</script>

<style lang="less" scoped>
// body{
//   height: 100%;
 
// }
  .centerContainer{
    // background-color: antiquewhite;
    font-family:'楷体' ;
    background-color: #eee;
    // background-color: #eee;
    .header{
      height: 135px;
      width: 100%;
      background-image:url(@/static/images/background.png);
      background-size: 100%;
      display: flex;
      align-items: center;
      .avator{
        .img{
          width: 71px;
          height: 71px;
          border-radius: 50%;
          margin-left: 20px;
        }
      }
      .user{
        font-family: "楷体";
        font-size: 18px;
        color:white;
        margin-left:20px;
        padding-top: 10px;
        .desc{
          font-size: 15px;
        }
      }
      .link{
        width: 32px;
        height: 32px;
        background-image: url(@/static/images/fairy.png);
        background-size: 4.21rem 3.78rem;
        // background-color: red;
        position: absolute;
        // z-index: 999;
        right: 5px;
        top: 30px;

      }
      .vip{
          width: 100px;
          height: 40px;
          background-image: linear-gradient(180deg,#574e44,#0e0e0e);
          // right: 100px;
          // right: 100px;
          position: absolute;
          // z-index: 999;
          right: 0;
          top: 75px;
          border-top-left-radius: 30px;
          border-bottom-left-radius: 30px;
          display: flex;
          // justify-content: center;
          padding: 0 10px;
          box-sizing: border-box;
          // display: flex;
          .thor{
            width: 34px;
            height: 32px;
            position: absolute;
            background-image: url(@/static/images/fairy.png);
            background-position: -0.80rem -0.7rem;
            background-size: 4.5rem 3.5rem;
            margin-bottom: 1px;
          }
          .text{
            display: inline-block;
            padding: 0.1rem 0;
            color: #ede7db;
            vertical-align: middle;
            margin-left: 30px;
            
            .word1{
              font-size: 10px;
            }
            .word2{
              font-size: 5px;
              vertical-align: middle;
              .icon{
                position: absolute;
                right: 2px;
                bottom: 3px;
              }
            }
          }
        }
    }
    .asset{
      background-color: #fff;
      .my_asset{
        font-size: 14px;
        height: 50px;
        line-height: 50px;
        // background-color: blue;
        margin-left: 15px;
        border-bottom: 1px solid #d9d9d9;
      }
      .assetList{
        height: 80px;
        display: flex;
        .assetItem{
          padding-top: 10px;
          width: 20%;
          display: flex;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          font-size: 10px;
        
          color:#0e0e0e;
          .sum{ 
              font-weight: bold;
            margin-bottom: 3px;
            .num{
              font-size: 15px;
            }
          }
          .desc{
          }
        }
      }
    }
    .advert{
      background-color: #fff;
      width: 95%;
      height: 45px;
      border: 1px solid rgba(221,26,33,.1);
      background-color: #fff6f4;
      margin: 0 auto;
      border-radius: 5px;
      display: flex;
      // justify-content: center;
      align-items: center;
      padding: 20px;
      box-sizing: border-box;
      font-size:10px;
      margin-bottom: 10px;
      .anniversary{
        width: 27px;
        height: 27px;
      }
      .welfare{
        width: 65px;
        height: 15px;
        margin:0 5px;
      }
      .btn{
        width: 68px;
        height: 22px;
        background-color: #dd1a21;
        line-height: 22px;
        text-align: center;
        // margin-left: 30px;
        position: absolute;
        right: 20px;
        color: white;
        border-radius: 30px;
      }
    }
    .middle{
      background-color: #fff;
      padding-top: 10px;
      margin-bottom: 20px;
      .card{
      text-align: center;
      border-bottom: 1px solid rgba(0,0,0,.15);
      .cardImg{
        width: 345px;
        height: 50px;
        margin: 10px 0;
      }
      }
      .list{
        display: flex;
        flex-wrap: wrap;
        .item{
          height: 90px;
          width: 33%;
          // background-color: red;
          border-bottom: 1px solid rgba(0,0,0,.15);
          border-right:1px solid rgba(0,0,0,.15) ;
          padding-top: 10px;
          display: flex;
          flex-direction: column;
          justify-content: center;
          text-align: center;
          .desc{
            margin-top: 3px;
            font-size: 10px;
          }
        }
      }

    }
    .bottom{
      height: 50px;
      // margin-bottom: 1000px;
      // background-color: red;
      font-size: 18px;
      line-height: 50px;
    }
    &::after{
      content: "";
      display: block;
      height: 50px;
    }

  }
</style>
